﻿using System;
using UnityEngine;

namespace RootMotion.Demos
{
	// Token: 0x020000D2 RID: 210
	[RequireComponent(typeof(CharacterController))]
	public class VRCharacterController : MonoBehaviour
	{
		// Token: 0x0600062B RID: 1579 RVA: 0x00005F78 File Offset: 0x00004178
		public void Awake()
		{
			this.characterController = base.GetComponent<CharacterController>();
			if (this.forwardDirection == null)
			{
				this.forwardDirection = base.transform;
			}
		}

		// Token: 0x0600062C RID: 1580 RVA: 0x00038F78 File Offset: 0x00037178
		public void Update()
		{
			Vector3 vector = new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical"));
			Vector3 forward = this.forwardDirection.forward;
			forward.y = 0f;
			this.characterController.SimpleMove(Quaternion.LookRotation(forward) * Vector3.ClampMagnitude(vector, 1f) * this.moveSpeed);
			if (Input.GetKeyDown(this.ratchetRight))
			{
				base.transform.rotation = Quaternion.Euler(0f, this.rotationRatchet, 0f) * base.transform.rotation;
			}
			else if (Input.GetKeyDown(this.ratchetLeft))
			{
				base.transform.rotation = Quaternion.Euler(0f, -this.rotationRatchet, 0f) * base.transform.rotation;
			}
			base.transform.rotation = Quaternion.Euler(0f, Input.GetAxis("Mouse X") * this.rotationSpeed, 0f) * base.transform.rotation;
		}

		// Token: 0x04000559 RID: 1369
		public float moveSpeed = 2f;

		// Token: 0x0400055A RID: 1370
		public float rotationSpeed = 2f;

		// Token: 0x0400055B RID: 1371
		[Range(0f, 180f)]
		public float rotationRatchet = 45f;

		// Token: 0x0400055C RID: 1372
		public KeyCode ratchetRight = KeyCode.E;

		// Token: 0x0400055D RID: 1373
		public KeyCode ratchetLeft = KeyCode.Q;

		// Token: 0x0400055E RID: 1374
		public Transform forwardDirection;

		// Token: 0x0400055F RID: 1375
		public CharacterController characterController;
	}
}
